#pragma once

#include <QtWidgets/QMainWindow>
#include "ui_MainWork.h"

#include "define.h"

#include <QMouseEvent>
#include "CListWidget.h"
#include "CTableWidget.h"
#include "CTableModel.h"
#include "DatabaseThread.h"
#include "CallbackDispatcher.h"



class MainWork : public QMainWindow
{
    Q_OBJECT

public:
    MainWork(QWidget *parent = nullptr);
    ~MainWork();

    enum class ViewType {
        TableView,
        ListView,
        SmallImageView,
        BigImageView,
        HugeImageView
    };


    void init();

    QVector<QVariant> convertToHeaders(QVector<QVariant> fields);


private slots:
    
    void onNewWorkClicked();
    void onAddWorkClicked();

    void on_actionList_triggered();
    void on_actionSmall_triggered();
    void on_actionBig_triggered();
    void on_actionMid_triggered();

private:
    Ui::MainWorkClass ui;

    int m_width = 0;
    int m_height = 0;

    QString m_workName;//工程名称
    QString m_workPath;//工程路径
    QString m_workDraw;//工程描述

    bool m_isNew = true;	//新建工程=true  模板工程=false

    QStandardItemModel* m_model;
    QItemSelectionModel* m_selectionModel;

    CListWidget* listWidget;
    ViewType viewtype;
    CTableWidget* tableWidget;
    CTableModel* tableDataModel;




};
